home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / lib / uw_optfn.c < prev    next >
C/C++ Source or Header  |  1991-01-25  |  853b  |  35 lines

  1. /*
  2.  *    uw library - uw_optfn
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8. #include "uwlib.h"
  9.  
  10. uwfnptr_t
  11. uw_optfn(uwin, optnum, optfn)
  12. UWIN uwin;
  13. uwopt_t optnum;
  14. uwfnptr_t optfn;
  15. {
  16.     uwfnptr_t oldfn;
  17.  
  18.     /*
  19.      * Establish an option-processing function (defined by the host).
  20.      * The specified function will be called whenever an option message
  21.      * is received from the server.  The previous function is returned.
  22.      */
  23.     oldfn = (uwfnptr_t)0;
  24.     if (uwin != (UWIN)0) {
  25.         if (optnum < UW_NUMOPTS) {
  26.             oldfn = uwin->uwi_options[optnum].uwi_optfn;
  27.             uwin->uwi_options[optnum].uwi_optfn = optfn;
  28.             uwin->uwi_uwerr = UWE_NONE;
  29.         } else
  30.             uwin->uwi_uwerr = UWE_INVAL;
  31.     }
  32.     uwerrno = uwin->uwi_uwerr;
  33.     return(oldfn);
  34. }
  35.